<% content_for :title do %>
  <%= t(:intword_create_title) %>
<% end %>
<% content_for :intro do %>
  <h2><%= t(:intword_create_title) %></h2>
  <p class="intro">
    <%= t(:intword_create_disclaimer) %>
  </p>
<% end %>
<div id="analysis_container"></div>
<div id="form_container">
  <%= image_tag "spin.gif" %>
</div>
<% content_for :footer do %>
  <script type="text/javascript" charset="utf-8">
    var root_path = "<%= root_path %>";
    if (!root_path.match(/\/$/)) {
      root_path += '/';
    }    
    // Dirty trick to access the images folder
    var image_path = "<%= image_path('foo') %>".replace('foo', '');

    var sources = [{name: t('source_all'), id: 0}];
    <% @sources.each do |source| -%>
      sources[sources.length] = {name: "<%= source.name %>", id: <%= source.id %> };
    <% end -%>
    $(document).ready(function() {
      quasar.createMasterForm($('#form_container'), $('#analysis_container'));
    });
    
    // Load the Visualization API and the relevant packages
    google.load('visualization', '1', {'packages':['motionchart', 'annotatedtimeline', 'imagesparkline', 'piechart', 'table', 'barchart']});

    // Set a callback to run when the API is loaded, and enable
    // the analysis form.
    google.setOnLoadCallback(function() {});
  </script>
<% end %>